using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;

namespace SoccerEvaluator.Common
{
    /// <summary>
    /// 
    /// </summary>
    public enum ProjectMode
    {
        /// <summary>
        /// Modo Lectura
        /// </summary>
        Read = 0,
        /// <summary>
        /// Modo visualizacion de datos
        /// </summary>
        Play = 1
    }
    /// <summary>
    /// 
    /// </summary>
    [DataContract]
    public class TemplateInfo
    {
        /// <summary>
        /// 
        /// </summary>
        public TemplateInfo()
        {
            this.Scores = new List<TemplateScoreInfo>();
        }

        /// <summary>
        /// 
        /// </summary>        
        public int ID
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>            
        public string Logo
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>            
        public int ExactScore
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>                
        public int CatchScore
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>                
        public int Total
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>                
        public string User
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>                
        public int ProjectMode
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>                
        public bool EnableUpdates
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>                
        public string UrlScores
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>                
        public string TableResults
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>        
        public List<TemplateScoreInfo> Scores
        {
            get;
            set;
        }

        /// <summary>
        /// 
        /// </summary>        
        public string Name
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>        
        public DateTime RegisterDate
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>                
        public DateTime StartDate
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>                
        public DateTime EndDate
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="r1"></param>
        /// <param name="r2"></param>
        /// <returns></returns>
        public static int CompareTotal(TemplateInfo r1, TemplateInfo r2)
        {
            int totalScore = r2.Total.CompareTo(r1.Total);

            int exactScore = r2.ExactScore.CompareTo(r1.ExactScore);

            int catchScore = r2.CatchScore.CompareTo(r1.CatchScore);

            int nameDiff = r1.Name.CompareTo(r2.Name);

            //return totalScore + exactScore;

            //Comparador ponderado
            return 7 * totalScore + 2 * exactScore + nameDiff;
        }
        /// <summary>
        /// 
        /// </summary>
        public int UserID
        {
            get;
            set;
        }

        public string AccessCode
        {
            get;
            set;
        }
    }

  
}
